using UnityEngine;
using QFramework;

// 1.请在菜单 编辑器扩展/Namespace Settings 里设置命名空间
// 2.命名空间更改后，生成代码之后，需要把逻辑代码文件（非 Designer）的命名空间手动更改
namespace QFramework.Example
{


    /// <summary>
    /// 拾取范围
    /// </summary>
	public partial class CollectableArea : ViewController,IController,ICanReadModels
	{


        CircleCollider2D collider2D;
        public IArchitecture GetArchitecture()
        {
			
			return Global.Interface;
        }

        public void ReadModels()
        {
            ///
            DataManager.Instance.gameDataModel.ItemRadius.Register(value =>
            {
                collider2D.radius = DataManager.Instance.gameDataModel.VisibleRange.Value + DataManager.Instance.gameDataModel.ItemRadius.Value;


            }).UnRegisterWhenGameObjectDestroyed(gameObject);
        }

        void Start()
		{
            collider2D = this.GetComponent<CircleCollider2D>();
            collider2D.radius = DataManager.Instance.gameDataModel.VisibleRange.Value+DataManager.Instance.gameDataModel.ItemRadius.Value;
            // Code Here
            ReadModels();

        }
	}
}
